package hn.sigit.view.workflow.transaction;

import hn.sigit.logic.bpm.ParcelData;
import hn.sigit.logic.ladmshadow.Util;

import java.util.ArrayList;
import java.util.List;

import javax.faces.event.ActionEvent;

public class DataEntryUndoHelper {
	private DataEntryHelper dataEntryHelper;
	
	public DataEntryUndoHelper(DataEntryHelper dataEntryHelper) {
		this.dataEntryHelper = dataEntryHelper;
	}
	
	public String applyUndo() {
		//TODO: Yet to finish
		Util.undoLastOperation(dataEntryHelper.getPresentationId());
		return null;
	}
	
	public String applyUndoAll() {
		List<ParcelData> parcelDataList = dataEntryHelper.getTransactionController().getTransactionProcess().getParcelDataList();
		List<Long> parcelIdList = new ArrayList<Long>();
		
		for (ParcelData pd : parcelDataList)
			parcelIdList.add(Long.valueOf(pd.getSuID()));
		
		Util.undoAll(dataEntryHelper.getPresentationId(), parcelIdList);
		return null;
	}

}
